package com.sky.mapper.admin;

import com.github.pagehelper.Page;
import com.sky.autoFill.AutoFill;

import com.sky.dto.DishPageQueryDTO;
import com.sky.enumeration.OperationType;
import com.sky.pojo.Dish;
import com.sky.vo.DishVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface DishMapper {

    /**
     * 根据分类id查询菜品数量
     *
     * @param categoryId
     * @return
     */
    @Select("select count(id) from dish where category_id = #{categoryId}")
    Integer countByCategoryId(Long categoryId);
    //添加菜品
    @AutoFill(OperationType.INSERT)
    void save(Dish dish);

    Page<DishVO> pageFind(DishPageQueryDTO dto);
    //根据id和状态查找菜品
    Integer selectByIdAndStatus(List<Integer> ids);
    //批量删除菜品
    void delete(List<Integer> ids);

    DishVO selectById(Integer dishId);

    void put(DishVO vo);

    Integer selectByIdAndStatus2(List<Integer> dishIdList);

    Map<String, Object> selectBystatus();

}
